package logger;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.logging.LogRecord;
import java.util.logging.SimpleFormatter;

public class SimpleFormatterExtends extends SimpleFormatter
{

	/**
	 * this function override the simple fromatter function and put in log only the
	 * messeage and the time.
	 * @param rec the message i want to write on the log.
	 * @return string of the meeseage.
	 */
	public String format(LogRecord rec)
	{
	//	StringBuffer stringBuf = new StringBuffer();
		String time = "dd/MM/yyyy HH:mm:ss";
		SimpleDateFormat sdf = new SimpleDateFormat(time);
		Calendar cal = Calendar.getInstance();
		cal.getTime();
		String ans =rec.getLevel()+ " " + this.formatMessage(rec)+" at " + sdf.format(cal.getTime())+ "\n";
		return ans;
	}
	
	

}
